import Api from '@/axios'

const user = {
  state: {
    userName: 'userNamexxx',
    userInfo: null
  },
  mutations: {
    getConfigData(state, data) {
      if (!data.res) return false
      let result = data.res.data
      if (result.code === 0) {
        state.userInfo = result.data
      } else {
        // localStorage.clear()
        state.userInfo = null
      }
    },
    handleClearUserinfo(state) {
      localStorage.clear()
      state.userInfo = null
    }
  },
  actions: {
    getConfiglist({commit, state}) {
      // Api.getUserinfo().then(res => commit('getConfigData', {
      //   res
      // }))
    }
  }
}
export default user
